package com.example.interrupted;

/**
 * @author:CrazyShaQiuShi
 * @email:3105334046@qq.com
 * @descript:关于线程中断
 * @version:1.0.0
 */
public class ThreadInterrupted extends Thread {

    @Override
    public void run() {
        while (true) {
            //如果当前线程标记为中断则优雅的退出
            if (Thread.currentThread().isInterrupted()) {
                System.out.println("准备删库跑路...");
                break;
            }
            Thread.yield();
            System.out.println("我在工作....");
        }
    }
}
